/**
  * Author: Mei
  * Date: 2020-12-10 20:44
  * Description: 变化的模板  变化的是个数和类型
  *
  */
#include <vector>
#include <iostream>
#include <string>
#include <bitset>
#include <functional>
#include <algorithm>
#include <list>
#include <set>
#include <map>
#include <ostream>

using namespace std;

class complex {
public:
    int display() const {
        return 111;
    }

    friend ostream &operator<<(ostream &out, const complex &c) {
        out << c.display();
        return out;
    }
};

void print(const char *s) {
    while(*s) {
        if(*s == '%' && *(++s) != '%') {
            throw runtime_error("invalid format string::missing arguments");
        }
        cout << *s++;
    }
}
template<typename T, typename ... Args>
void print(const char *s, T value, Args ... args) {
    while(*s) {
        if(*s == '%' && *(++s) != '%') {
            cout << value;
            print(++s, args...);
            return;
        }
        cout << *s++;
    }
    __throw_logic_error("extra arguments provided to print");
};
int main() {
    int *pi = new int;
    //print("%d %d %p %f asdf %a\n", 15, "this is Boby", pi, 2.32);
    printf("%%%%\n");


    return 0;
}

